import 'package:json_annotation/json_annotation.dart';

part 'base_response.g.dart';

@JsonSerializable()
class BaseResponse {
  int code;
  String msg;
  Map<String, dynamic> data;

  BaseResponse({this.code, this.msg, this.data});

  bool isSuccess() {
    return code == 0;
  }

  factory BaseResponse.fromJson(Map<String, dynamic> json) => _$BaseResponseFromJson(json);

  Map<String, dynamic> toJson() => _$BaseResponseToJson(this);
}